﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace b2_数组
{
    internal class Program
    {
        static void Main(string[] args)
        {
            Console.Write("已知下列数组：\n");
            Console.Write("[4,3,2,6,8,7,4]\n");
            int[] nums = { 4, 3, 2, 6, 8, 7, 4 };
            int i,sum,max,min,a;
            double average;
            sum = 0;
            max = nums[0];
            min = nums[0];
            for (i = 0; i < 7; i++)
            {
                if (min >= nums[i])
                    min = nums[i];

                if (max <= nums[i])
                    max = nums[i];
                sum = sum + nums[i];
            }
            average = sum / 7.0;
            Console.Write("最大值为：");
            Console.Write(max.ToString());
            Console.Write("\n");
            Console.Write("最小值为：");
            Console.Write(min.ToString());
            Console.Write("\n");
            Console.Write("平均值为：");
            Console.Write(average.ToString());
            Console.Write("\n");
            Console.Write("数组元素之和为：");
            Console.Write(sum.ToString());
            Console.Write("\n");
        }
    }
}
